package com.zrrd.learn.chapter06数组;

/**
 * 汉字题
 *
 * @author wrn
 * @version 1.0
 * @date 2023/7/14 19:14
 */

public class Chinese01 {

    /**
     * 打印出“三”字
     */
    public static void question01(){
        System.out.println("1题打印出“三”字\n");
        for (int i = 0; i < 3; i++) {
            if (i==0||i==2){
                for (int j = 0; j < 10; j++) {
                    System.out.print("*");
                }
            }
            if (i==1){
                System.out.print(" ");
                for (int j = 0; j < 8; j++) {
                    System.out.print("*");
                }
            }
            System.out.println();
        }
    }

    /**
     * 打印出“十”字
     */
    public static void question02(){
        System.out.println("\n2题打印出“十”字\n");
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                if (i==4||j==4){
                    System.out.print("* ");
                }else {
                    System.out.print("  ");
                }
            }
            System.out.println();
        }
    }

    /**
     * 打印出“田”字
     */
    public static void question03(){
        System.out.println("\n3题打印出“田”字\n");
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                if (i==4||i==0||i==8||j==4||j==0||j==8){
                    System.out.print("* ");
                }else {
                    System.out.print("  ");
                }
            }
            System.out.println();
        }
    }

    /**
     * 打印出“中”字
     */
    public static void question04(){
        System.out.println("\n4题打印出“中”字\n");
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                if (i==4||i==2||j==4){
                    System.out.print("* ");
                } else if (j==0&&i==3||j==8&&i==3){
                    System.out.print("* ");
                } else {
                    System.out.print("  ");
                }
            }
            System.out.println();
        }
    }

    /**
     * 打印出“土”字
     */
    public static void question05(){
        System.out.println("\n5题打印出“土”字\n");
        for (int i = 0; i < 9; i++) {
            for (int j = 0; j < 9; j++) {
                if (i==3&&0<j&&j<8||i==8||j==4){
                    System.out.print("* ");
                } else {
                    System.out.print("  ");
                }
            }
            System.out.println();
        }
    }





    public static void main(String[] args) {
        question01();
        question02();
        question03();
        question04();
        question05();

    }
}
